<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>统计成绩最大值和最小值</title>
</head>
<body>

    <script>
        var total=0;
        var scores=[];
        for( i=0;i<5;i++){
            var score=parseFloat(prompt("请输入第"+(i+1)+"门成绩："))
            scores[i] =score;
        }  
        document.write("五门成绩分别是：")
        for(i=0;i<5;i++){
            document.write(scores[i]+"\t");
        }
        
        for(var i=0;i<5;i++){
            total+=scores[i];
        }
        document.write("\n"+"总分："+total)
        var average=total/5;
        document.write("平均分为:"+average.toFixed(2));
        var max=min=scores[0];
        for(i=1;i<5;i++){
            if(max<scores[i]){
                max=scores[i];
            }
            if(min>scores[i]){
                min=scores[i];
            }

        }
        document.write("最高分为："+max);
        document.write("最低分为："+min);
        
        
    </script>
</body>
</html>